<%@page import="javax.xml.soap.Detail"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%
         request.setCharacterEncoding("UTF-8");
%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.Calendar"%>
<%@ page import="java.util.GregorianCalendar"%>
<%
Statement sql;
Connection con;
ResultSet rs;
   try{
       Class.forName("com.mysql.jdbc.Driver");
       }
       catch(Exception e){
    	   out.print("加载失败");
       };
try{ 
    
      String uri="jdbc:mysql://localhost:3306/sharing"; 
          
    con = DriverManager.getConnection(uri,"root","ZHUBI123.");
    String reply = request.getParameter("id");
    String name = (session.getAttribute("username")).toString();
    String content = request.getParameter("content");
   int year, month, day, hour, minute, second;
     String time;
     GregorianCalendar calendar;
    calendar = new GregorianCalendar();
    year = calendar.get(Calendar.YEAR);
    month = calendar.get(Calendar.MONTH) + 1;
    day = calendar.get(Calendar.DAY_OF_MONTH);
    hour = calendar.get(Calendar.HOUR_OF_DAY);
    minute = calendar.get(Calendar.MINUTE);
    second = calendar.get(Calendar.SECOND);
    time = year + "年" + month + "月" + day + "日" + hour + "：" + minute+ "：" + second;
    byte[] bb=content.getBytes("UTF-8");
    content=new String(bb);
    String updateCondition = "insert into reply ( name, content, time, reply )values('"+ name+ "','"+ 
    		content+ "','"+ time+ "','"+ reply+"')";
     sql=con.createStatement();
     sql.executeUpdate(updateCondition);
     out.print("更新成功");
     response.sendRedirect("Detail.jsp?id=" + reply);
	
       }
       catch (Exception e){
    	   out.print("回复失败");
       }
       %>

